package com.fzy.springsecurity.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fzy.springsecurity.bean.TUser;
import com.fzy.springsecurity.mapper.TUserMapper;
import com.fzy.springsecurity.service.TUserService;
import jakarta.annotation.Resource;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author fzy
 * @since 2024-10-04
 */
@Service
public class TUserServiceImp extends ServiceImpl<TUserMapper, TUser> implements TUserService {
    @Resource
    PasswordEncoder encoder;

    @Override
    public void saveUserDetails(TUser tUser) {
        tUser.setPassword(encoder.encode(tUser.getPassword()));
        tUser.insert();
    }
}
